import { createRouter, createWebHistory } from "vue-router";
import Layout from "@/components/Layout.vue";

const routes = [
  {
    path: "/",
    redirect: "/category",
    component: Layout,
    children: [
      {
        path: "/category",
        redirect: "/category/list",
        children: [
          {
            path: "list",
            name: "CategoryList",
            component: () => import("@/views/category/List.vue"),
          },
          {
            path: "detail/:id",
            name: "CategoryDetail",
            component: () => import("@/views/category/Detail.vue"),
          },
        ],
      },
    ],
  },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
